//
//  ProductCell.m
//  123Mua_Modules
//
//  Created by duong nguyen on 11/4/12.
//  Copyright (c) 2012 uit. All rights reserved.
//

#import "ProductCell.h"

@implementation ProductCell
@synthesize productImage,productLabel,containerView,footerView;
@synthesize upperFooterView;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self.containerView setBackgroundColor:[UIColor redColor]];
        self.productLabel=[[UILabel alloc]initWithFrame:CGRectMake(6, 5, 290, 26)];
        self.productImage=[[UIImageView alloc]initWithFrame:CGRectMake(6, 32, 288, 336)];
        [self.productImage setBackgroundColor:[UIColor blueColor]];
        [self.productImage.layer setCornerRadius:10.0];
        [self.productImage setImage:[UIImage imageNamed:@"product_test.png"]];
        [self.productImage setContentMode:UIViewContentModeScaleToFill];
        self.productImage.layer.masksToBounds=YES;    
        
        self.footerView=[[UIView alloc]initWithFrame:CGRectMake(1, 375, 298, 37)];
        [self.footerView setBackgroundColor:[UIColor colorWithRed:(237/255.f) green:(239/255.f) blue:(244/255.f) alpha:1.0]];
        self.upperFooterView=[[UIView alloc]initWithFrame:CGRectMake(1, 373, 298, 2)];
        [self.upperFooterView setBackgroundColor:[UIColor colorWithRed:(228/255.f) green:(230/255.f) blue:(234/255.f) alpha:1.0]];
        
        [self.contentView addSubview:productLabel];
        [self.contentView addSubview:productImage];
        [self.contentView addSubview:footerView];
        [self.contentView addSubview:upperFooterView];
        
        // Create custom content view
        [self.contentView setBackgroundColor:[UIColor whiteColor]];
        [self.contentView.layer setBorderColor:[UIColor grayColor].CGColor];
        [self.contentView.layer setBorderWidth:1.0f];
        [self.contentView.layer setCornerRadius:5.0f];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)dealloc{
    [upperFooterView release];
    [footerView release];
    [containerView release];
    [productImage release];
    [productLabel release];
    [super dealloc];
}
@end
